Update Profile
/api/v1/users/meUpdates fields on the authenticated patient's own profile. Partial update — all fields optional. Self-only. Returns the full updated profile, not a diff.
https://api.care360-next.carevalidate.com/api/v1/users/mehttps://api-staging.care360-next.carevalidate.com/api/v1/users/meThe body must contain at least one recognized field. Unknown body keys are silently dropped. Pass null to clear nullable fields. Omitting a field leaves it unchanged.
Headers
cv-api-keystringrequiredAuthorizationstringrequiredBearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9...Content-TypestringrequiredRequest Body
firstNamestringoptionallastNamestringoptionaldobstringoptional1990-05-15genderstringoptionalphoneNumberstringoptional+15551234567addressstring | nulloptionaladdress2string | nulloptionalcitystring | nulloptionalstatestringoptionalcountrystringoptionalUSpostalCodestring | nulloptionalallergiesstring | nulloptionalhealthConditionsstring | nulloptionalcurrentMedicationsstring | nulloptionalThe email field is read-only via this endpoint and is not in the schema. Unknown body keys (including email) are silently dropped.
The Active-Case Rule
If the request includes any of firstName, lastName, dob, gender, the server checks whether the patient has any active cases in the calling organization. Active statuses are: Approved, Assigned, InProgress, NoDecision, Rejected. (Statuses outside that list — notably Open — are not active.)
When the rule fires, no fields are updated — including the non-restricted fields in the same body. Surface a clear "complete or close active cases first" message and let the user retry without those four fields.
Behavior
- Auth middleware authenticates and attaches
req.patientUserandreq.patientOrganization. - Body is parsed by
ProfileUpdateSchema.countryis uppercased; unknown keys are dropped. - If any restricted field is present, the active-case check runs. On failure the request fails atomically — no fields are written.
dob(YYYY-MM-DD) is converted to aDateif present.- A single
prisma.user.updateapplies all recognized fields. - The updated
Userrow is mapped to the full profile shape and returned.
Example Requests
- cURL — non-restricted fields
- cURL — clear nullable
- cURL — restricted fields
- JavaScript
- Python
curl -X PATCH '<BASE_URL>/api/v1/users/me' \
-H 'cv-api-key: <redacted>' \
-H 'Authorization: Bearer <accessToken>' \
-H 'Content-Type: application/json' \
-d '{
"address": "123 Main St",
"city": "New York",
"state": "NY",
"country": "us",
"postalCode": "10001",
"allergies": "Penicillin"
}'
curl -X PATCH '<BASE_URL>/api/v1/users/me' \
-H 'cv-api-key: <redacted>' \
-H 'Authorization: Bearer <accessToken>' \
-H 'Content-Type: application/json' \
-d '{ "address": null }'
curl -X PATCH '<BASE_URL>/api/v1/users/me' \
-H 'cv-api-key: <redacted>' \
-H 'Authorization: Bearer <accessToken>' \
-H 'Content-Type: application/json' \
-d '{
"firstName": "Jane",
"lastName": "Doe",
"dob": "1990-05-15",
"gender": "FEMALE"
}'
const response = await fetch(
'<BASE_URL>/api/v1/users/me',
{
method: 'PATCH',
headers: {
'cv-api-key': '<redacted>',
'Authorization': 'Bearer <accessToken>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
address: '123 Main St',
city: 'New York',
state: 'NY',
country: 'us',
postalCode: '10001',
}),
}
);
const data = await response.json();
console.log(data);
import requests
response = requests.patch(
'<BASE_URL>/api/v1/users/me',
headers={
'cv-api-key': '<redacted>',
'Authorization': 'Bearer <accessToken>',
'Content-Type': 'application/json',
},
json={
'address': '123 Main St',
'city': 'New York',
'state': 'NY',
'country': 'us',
'postalCode': '10001',
},
)
print(response.json())
Responses
▶200SuccessReturns the full updated profile, not a diff. Replace the local profile object on success.
{
"status": 200,
"success": true,
"data": {
"profile": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"email": "patient@example.com",
"firstName": "Jane",
"lastName": "Doe",
"phoneNumber": "+15551234567",
"dob": "1990-05-15T00:00:00.000Z",
"gender": "FEMALE",
"address": "123 Main St",
"address2": null,
"city": "New York",
"state": "NY",
"country": "US",
"postalCode": "10001",
"allergies": "Penicillin",
"healthConditions": "Asthma",
"currentMedications": "Albuterol",
"createdAt": "2025-08-01T12:34:56.000Z"
}
}
}
▶400Validation errorcv-api-key missing, body fails Zod (e.g. dob not YYYY-MM-DD, gender not in enum, country length not 2, firstName/lastName empty).
{
"status": 400,
"success": false,
"error": "Validation failed",
"code": "VALIDATION_ERROR"
}
▶400Active-case ruleBody included firstName, lastName, dob, or gender while the patient has active cases in the calling organization. No fields were updated.
{
"status": 400,
"success": false,
"error": "Cannot update firstName, lastName, dob, or gender while you have active cases",
"code": "VALIDATION_ERROR"
}
▶401Authentication failureAuthorization header missing/malformed; JWT invalid/expired; wrong type; org mismatch; or the user no longer exists.
{
"status": 401,
"success": false,
"error": "Invalid or expired token",
"code": "VALIDATION_ERROR"
}
▶404Patient not foundDefensive — the user record was missing when the handler ran.
{
"status": 404,
"success": false,
"error": "Patient not found",
"code": "VALIDATION_ERROR"
}